package com.lds.register.center.client.autoconfigure;

import com.lds.register.center.client.listener.AppInstanceAutoRegistration;
import com.lds.register.center.client.properties.RegisterCenterClientProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(RegisterCenterClientProperties.class)
public class RegisterCenterClientAutoConfiguration {
    private final RegisterCenterClientProperties registerCenterClientProperties;

    public RegisterCenterClientAutoConfiguration(RegisterCenterClientProperties registerCenterClientProperties) {
        this.registerCenterClientProperties = registerCenterClientProperties;
    }

    @Bean
    public AppInstanceAutoRegistration registerAppInstanceStarterRegisterCenterClient() {
        return new AppInstanceAutoRegistration(registerCenterClientProperties);
    }
}
